<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            constructor(name, age) {
                this.name = name;
                this.age = age;
            }

            call() {
                console.log(this.name + '今年' + this.age + '岁');
            }
        }

        let person1 = new Person('xiaoming', 26);

        const proxyPerson1 = new Proxy(person1, {
            get(target,property) {
                console.log(target[property]);
                return property in target ? target[property] : undefined;
            },
            set(target, property, value) {
                console.log(target[property],value);
                target[property] = value;
            }
        });

        let pp = proxyPerson1.age;
        proxyPerson1.name = 'xiaomuang';
        console.log(proxyPerson1);
    </script>
</body>

</html>